//
//  NSNotificationCenter+extension.h
//  GK
//
//  Created by Seven on 2018/12/27.
//  Copyright © 2018 Seven. All rights reserved.
//

#import <Foundation/Foundation.h>


//Notification

#define NotificationCenter [NSNotificationCenter defaultCenter]

#define PostNotification(__signal__,__object__) \
[NotificationCenter postNotificationName:__signal__ object:__object__]

#define PostNotificationInfo(__signal__,__object__,__userInfo__) \
[NotificationCenter postNotificationName:__signal__ object:__object__ userInfo:__userInfo__]


#define RegistNotification(__signal__,__function__)\
[NotificationCenter addObserver:self selector:@selector(__function__) name:__signal__ object:nil]


#define RemoveNotification(__signal__)\
[NotificationCenter removeObserver:self name:__signal__ object:nil]

extern NSString *const NotificationDidLogout;
extern NSString *const NotificationDidLogin;
extern NSString *const NotificationDidUpdateConfig;
extern NSString *const NotificationFetchConfigError;
extern NSString *const NotificationClosePlayerView;
extern NSString *const NotificationDidAddToBlacklist;
extern NSString *const NotificationNetworkChanged;
extern NSString *const NotificationDidPublishVideo;

extern NSString *const NotificationUpdateUserInfo;

NS_ASSUME_NONNULL_BEGIN

@interface NSNotificationCenter(extension)

+ (void)postName:(NSString *)name;
+ (void)addObserver:(id)observer selector:(SEL)aSelector name:(nullable NSNotificationName)aName;

+ (void)removeObserver:(id)observer;
+ (void)removeObserver:(id)observer name:(nullable NSNotificationName)aName object:(nullable id)anObject;
@end

NS_ASSUME_NONNULL_END
